package com.zbkj.admin.controller.platform.v2;

import com.zbkj.dal.base.page.CommonPage;
import com.zbkj.dal.base.result.CommonResult;
import com.zbkj.dal.pojo.request.order.merchant.AdminMerchantRentOrderQueryRequest;
import com.zbkj.dal.pojo.request.order.platform.PlatformRentOrderQueryRequest;
import com.zbkj.dal.pojo.response.order.merchant.MerchantOrderDetailNewResponse;
import com.zbkj.dal.pojo.response.order.merchant.MerchantOrderPageNewResponse;
import com.zbkj.dal.pojo.response.order.platform.PlatformRentOrderPageNewResponse;
import com.zbkj.service.service.order.platform.AdminPlatformRentOrderV2Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author wangzhengyan
 * @date 2024/4/12 9:08 PM
 */
@RestController
@Api(tags = "平台管理-承享订单")
@RequestMapping("/api/admin/platform/v2/order/rent")
public class PlatformRentOrderV2Controller {

    @Resource
    private AdminPlatformRentOrderV2Service adminPlatformRentOrderV2Service;

    //获取平台管理-承享订单列表
    @PreAuthorize("hasAuthority('platform:order:page:list')")
    @ApiOperation(value = "商户端订单分页列表") //配合swagger使用
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public CommonResult<CommonPage<PlatformRentOrderPageNewResponse>> getList(@Validated @RequestBody PlatformRentOrderQueryRequest request) {
        return CommonResult.success(CommonPage.restPage(adminPlatformRentOrderV2Service.getAdminPlatformRentOrderList(request)));
    }

    // 获取商户后台-订单管理-承享订单详情
    @PreAuthorize("hasAuthority('platform:order:detail')")
    @ApiOperation(value = "商户端订单详情") //配合swagger使用
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    public CommonResult<MerchantOrderDetailNewResponse> getDetail(@RequestParam("orderNo") String orderNo) {
        return CommonResult.success(adminPlatformRentOrderV2Service.getAdminPlatformRentOrderDetail(orderNo));
    }



}
